package com.cooldatasoft.domain.serviceImpl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.cooldatasoft.domain.dao.UserProjectRolesDao;
import com.cooldatasoft.domain.model.Project;
import com.cooldatasoft.domain.model.Roles;
import com.cooldatasoft.domain.model.User;
import com.cooldatasoft.domain.model.UserProjectRoles;
import com.cooldatasoft.domain.service.UserProjectRolesService;

@Service("userProjectRolesService")
public class UserProjectRolesServiceImpl implements UserProjectRolesService {
	
	@Autowired
	private UserProjectRolesDao userProjectRolesDao;

	public Long insertUserProjectRoles(UserProjectRoles userProjectRoles) {
		return userProjectRolesDao.insert(userProjectRoles);
	}

	public void updateUserProjectRoles(UserProjectRoles userProjectRoles) {
		userProjectRolesDao.update(userProjectRoles);
	}

	public void deleteUserProjectRoles(Long userProjectRolesId) {
		userProjectRolesDao.delete(userProjectRolesId);		
	}

	public List<UserProjectRoles> getAllUserProjectRoles() {
		return userProjectRolesDao.getAll();
	}

	@Override
	public List<UserProjectRoles> getUserProjectRolesByIdUser(User idUser) {
		return userProjectRolesDao.getUserProjectRolesByIdUser(idUser);
	}

	@Override
	public List<UserProjectRoles> getUsersOnProject(Project idProject) {
		return userProjectRolesDao.getUsersOnProject(idProject);
	}

	@Override
	public UserProjectRoles getUserProjectRolesByIdUserAndIdProject(
			Project projects, User user) {
		return userProjectRolesDao.getUserProjectRolesByIdUserAndIdProject(projects, user);
	}
	
	@Override 
	public List<UserProjectRoles> getUsersByRole(Project project, Roles role) {
		return userProjectRolesDao.getUsersByRole(project, role); 
	}

	@Override
	public List<UserProjectRoles> getUsersByRoleOnProject(Project projects,
			Roles role) {
		return userProjectRolesDao.getUsersByRoleOnProject(projects, role);
	}

	@Override
	public List<UserProjectRoles> getProjectsByUserWithRole(User user,
			Roles role) {
		return userProjectRolesDao.getProjectsByUserWithRole(user, role);
	}

	@Override
	public List<UserProjectRoles> getExistingRecord(Project project,
			User user, Roles role) {
		return userProjectRolesDao.getExistingRecord(project, user, role);
	}


}
